package com.hightrast.service.api.domain.bo;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;

import java.time.OffsetDateTime;
import java.util.ArrayList;
import java.util.List;

/**
 * <p>
 * 订单表
 * </p>
 *
 * @author hx
 * @since 2025-01-24
 */
@Data
@Accessors(chain = true)
@ApiModel(value="RastOrders对象", description="订单表")
public class QueryShopifyOrders {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty("主键id")
    private Long id;

    @ApiModelProperty(value = "顾客邮箱")
    private String email;

    @ApiModelProperty(value = "订单关闭时间")
    private OffsetDateTime closed_at;

    @ApiModelProperty(value = "订单创建时间")
    private OffsetDateTime created_at;

    @ApiModelProperty(value = "订单最后更新时间")
    private OffsetDateTime updated_at;

    @ApiModelProperty(value = "订单编号")
    private Integer number;

    @ApiModelProperty(value = "订单备注")
    private String note;

    @ApiModelProperty(value = "订单token")
    private String token;

    @ApiModelProperty(value = "支付网关")
    private String gateway;

    @ApiModelProperty(value = "是否为测试订单")
    private Boolean test;

    @ApiModelProperty(value = "订单总金额")
    private String total_price;

    @ApiModelProperty(value = "订单小计")
    private String subtotal_price;

    @ApiModelProperty(value = "订单总重量")
    private String total_weight;

    @ApiModelProperty(value = "税费总额")
    private String total_tax;

    @ApiModelProperty(value = "是否包含税费")
    private Boolean taxes_included;

    @ApiModelProperty(value = "货币")
    private String currency;

    @ApiModelProperty(value = "财务状态")
    private String financial_status;

    @ApiModelProperty(value = "是否确认")
    private Boolean confirmed;

    @ApiModelProperty(value = "订单总折扣")
    private String total_discounts;

    @ApiModelProperty(value = "商品总金额")
    private String totalLine_items_price;

    @ApiModelProperty(value = "是否接受营销")
    private Boolean buyer_accepts_marketing;

    @ApiModelProperty(value = "订单名称")
    private String name;

    @ApiModelProperty(value = "订单编号")
    private String order_number;

    @ApiModelProperty(value = "订单来源")
    private String source_name;

    @ApiModelProperty(value = "订单状态链接")
    private String order_status_url;

    @ApiModelProperty(value = "呈现的货币")
    private String presentment_currency;

    @ApiModelProperty(value = "GraphQL API ID")
    private String admin_graphql_api_id;

    @ApiModelProperty(value = "当前总金额")
    private String current_total_price;

    @ApiModelProperty(value = "未支付总额")
    private String total_outstanding;

    @ApiModelProperty(value = "当前小计")
    private String current_subtotal_price;

    @ApiModelProperty(value = "当前税费")
    private String current_total_tax;

    @ApiModelProperty(value = "当前折扣")
    private String current_total_discounts;

    @ApiModelProperty(value = "发货状态")
    private String fulfillment_status;

    @ApiModelProperty(value = "折扣类型")
    private List<discountCodes> discount_codes = new ArrayList<>();

    @ApiModelProperty(value = "商品项")
    List<QueryShopifyOrderProductItems> line_items = new ArrayList<>();

    @ApiModelProperty(value = "退款")
    List<refunds> refunds = new ArrayList<>();

    @Data
    @ApiModel("折扣信息")
    public static class discountCodes {
        @ApiModelProperty(value = "折扣码")
        private String code;
        @ApiModelProperty(value = "折扣金额")
        private String amount;
        @ApiModelProperty(value = "折扣类型")
        private String type;
    }

    @Data
    @ApiModel("退款项")
    public static class refunds {
        @ApiModelProperty(value = "退款项列表")
        private List<refundsItem> refund_line_items = new ArrayList<>();
        @ApiModelProperty(value = "退款交易信息")
        private List<transactions> transactions = new ArrayList<>();
    }

    @Data
    @ApiModel("退款项")
    public static class refundsItem {
        @ApiModelProperty(value = "当前数据主id")
        private Long id;
        @ApiModelProperty(value = "订单商品项id")
        private Long line_item_id;
        @ApiModelProperty(value = "退款数量")
        private Integer quantity;
        @ApiModelProperty(value = "小计")
        private String subtotal;
    }

    @Data
    @ApiModel("退款交易信息")
    public static class transactions {
        @ApiModelProperty(value = "订单id")
        private Long order_id;
        @ApiModelProperty(value = "小计")
        // pending failure success error
        private String status;
    }
}
